//
//  NSObjectExtension.swift
//  JKTools
//
//  Created by 姜奎 on 2024/4/25.
//

import Foundation

extension NSObject {
    @discardableResult
    public func swizzle(original: Selector, swizzled: Selector) -> Bool {
        guard let originalMethod = class_getInstanceMethod(Self.self, original),
              let swizzledMethod = class_getInstanceMethod(Self.self, swizzled) else { return false }
        
        method_exchangeImplementations(originalMethod, swizzledMethod)
        
        return true
    }
}
